<template>
	<view class="inform">
		<headertop title="奖码记录" :back1="back1"></headertop>
		<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Group 11523@2x.png" class="inform_back"
			mode=""></image>
		<view class="dangqianyue">
			<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Rectangle 24497@2x.png" mode=""
				class="dangqianyueback"></image>
			<view class="linetop">
				<view class="lable">
					当前抽奖码
				</view>
				<view class="yue">
					{{totle}}个
				</view>
			</view>
		</view>
		<view class="contents">
			<view class="toptitle">
				抽奖码记录
			</view>
			<view class="scorwwy">
				<view class="scorwwyitem" v-for="item in list" :key="item.id">
					<view class="center">
						<view class="texts">
							<view class="t1">
								{{item.memo}}
							</view>
							<view class="t2">
								{{timestampfun(item.createtime*1000)}}
							</view>
						</view>
						<view class="addnum">
							+1
						</view>

					</view>
				</view>
				<view class="msgicon" v-if="!list.length">
					<image src="/static/微信图片_20250508155422.png" mode="widthFix"></image>
					<view class="msgtext">
						暂无奖码记录
					</view>
				</view>

			</view>

		</view>
	</view>
</template>

<script>
	import {
		jiangma
	} from '@/common/api/api.js'
	import headertop from '@/components/header.vue'
	export default {
		components: {
			headertop
		},
		data() {
			return {
				back1: 0,
				list: [],
				totle: ''
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			timestampfun(time) {
				const date = new Date(time);
				const year = date.getFullYear();
				const month = String(date.getMonth() + 1).padStart(2, "0");
				const day = String(date.getDate()).padStart(2, "0");
				const hours = String(date.getHours()).padStart(2, "0");
				const minutes = String(date.getMinutes()).padStart(2, "0");
				const seconds = String(date.getSeconds()).padStart(2, "0");
				const formattedDate = `${year}-${month}-${day}`;
				return formattedDate
			},
			async init() {
				const res = await jiangma()
				if (res.code == 1) {
					this.list = res.data.list
					this.totle = res.data.count
				}
			}
		},

		onPageScroll(e) {
			console.log(e, 'eeeeeeeeeeeeeee');
			if (e.scrollTop > 100) {
				this.back1 = '#A2AEFF'
			} else {
				this.back1 = ''
			}
		}
	}
</script>

<style lang="scss">
	.msgicon {
		width: 300rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-size: 45rpx;
			font-weight: bold;
			text-align: center;
			width: 100%;
		}

		image {
			width: 300rpx;
		}
	}

	page {
		background: #fff;
	}

	.inform {
		width: 100%;
		overflow: hidden;
		position: relative;

		&_back {
			width: 100%;
			height: 804rpx;
			position: absolute;
			z-index: -1;
		}

		.dangqianyue {
			width: 686rpx;
			height: 196rpx;
			margin: auto;
			margin-top: 220rpx;
			position: relative;
			display: flex;
			align-items: center;

			.dangqianyueback {
				width: 686rpx;
				height: 196rpx;
				position: absolute;
				z-index: -1;
			}

			.linetop {
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.lable {
					font-weight: bold;
					font-size: 32rpx;
					color: #412A9C;
					margin-left: 30rpx;
				}

				.yue {
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 64rpx;
					color: #FFFFFF;
					line-height: 52rpx;
					margin-right: 40rpx;
				}
			}
		}

		.contents {
			width: 100%;
			border-radius: 48rpx 48rpx 0rpx 0rpx;
			margin-top: -30rpx;
			overflow: hidden;
			background: #fff;

			.toptitle {
				width: 686rpx;
				margin: auto;
				margin-top: 30rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #1D2129;
			}

			.scorwwy {
				width: 686rpx;
				overflow: hidden;
				margin: auto;
				margin-top: 30rpx;

				.scorwwyitem {
					width: 686rpx;
					height: 142rpx;
					background: #F2F3F5;
					border-radius: 16rpx 16rpx 16rpx 16rpx;
					display: flex;
					align-items: center;
					overflow: hidden;
					margin-bottom: 24rpx;

					.center {
						width: 622rpx;
						display: flex;
						align-items: center;
						margin: auto;
						justify-content: space-between;

						.texts {
							width: 252rpx;
							overflow: hidden;

							.t1 {
								font-family: PingFang SC, PingFang SC;
								font-weight: 400;
								font-size: 28rpx;
								color: #1D2129;
							}

							.t2 {
								font-family: PingFang SC, PingFang SC;
								font-weight: 400;
								font-size: 24rpx;
								color: #86909C;
							}
						}

						.addnum {
							font-family: PingFang SC, PingFang SC;
							font-weight: bold;
							font-size: 36rpx;
							color: #1D2129;
						}
					}
				}
			}

		}




	}
</style>